package com.google.code.kjug.guava.app;

import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

import static junit.framework.Assert.assertEquals;

public class Presentation_UT {

    @Test (expected =  ArrayIndexOutOfBoundsException.class)
    public void arrayShouldBombOutIfOutOfRange() {
        String[] phoneBook = new String[10];

        phoneBook[11] = "going to bomb out";

        //exception expected
    }

    @Test
    public void cantMixTypesInAnArray() {
        Bird[] birds = new Bird[10];
        Cardinal cardinal = new Cardinal();

        birds[0] = cardinal;

        assertEquals(cardinal, birds[0]);
    }

    private class Bird {

    }

    private class Cardinal extends Bird {

    }

    @Test
    public void loopThroughArray() {
        Bird[] birds = new Bird[10];
        for (int i = 0; i < 10; i++) {
            birds[i] = new Bird();
        }
    }

    @Test
    public void mapsLetYouGetWithAnyTypeYouWant() {
        Map<String, String> map = new HashMap<String, String>();

        map.get(64);

        //yikes!
    }

}
